package com.app.mymusic.service;

import com.app.mymusic.model.Songs;
import com.app.mymusic.test.dagger2.User;

import java.util.Map;

import okhttp3.RequestBody;
import okhttp3.ResponseBody;
import retrofit2.Call;
import retrofit2.http.GET;
import retrofit2.http.POST;
import retrofit2.http.Part;
import retrofit2.http.PartMap;
import retrofit2.http.Path;
import retrofit2.http.Query;
import retrofit2.http.QueryMap;
import rx.Observable;

/**
 * Created by Administrator on 2016-12-1.
 */

public interface ApiService {

        public static final String Base_URL = "http://ip.taobao.com/";
        /**
         *普通写法
         */
        @GET("test.jsp")
        Observable<User> getUser();

        /**
         * 登陆
         * @param name
         * @param psw
         * @param id
     * @return
     */
        @GET("androids/loginVerify.jsp")
        Observable<ResponseBody> login(@Query("F_LOGINNAME")String name,@Query("F_PASSWORD")String psw,@Query("channelId") String id);
      /*  format=json&calback=&from=webapp_music&method=baidu.ting.billboard.billList&type=1&size=10&offset=0*/
        @GET("ting")
        Observable<Songs> getCharts(@Query("format")String format, @Query("calback")String calback, @Query("from")String from
        , @Query("method")String method , @Query("type") String type, @Query("size")String size, @Query("offset")String offset);

        @GET("service/getIpInfo.php/")
        Observable<ResponseBody> getData(@Query("ip") String ip);


        @GET("{url}")
        Observable<ResponseBody> executeGet(
                @Path("url") String url,
                @QueryMap Map<String, String> maps);


        @POST("{url}")
        Observable<ResponseBody> executePost(
                @Path("url") String url,
                @QueryMap Map<String, String> maps);

        @POST("{url}")
        Call<ResponseBody> uploadFiles(
                @Path("url") String url,
                @Part("filename") String description,
                @PartMap() Map<String, RequestBody> maps);

    }

